//
//  FindPathSecondAnotherCell.m
//  
//
//  Created by 郭明皓 on 15/10/30.
//
//

#import "FindPathSecondAnotherCell.h"

#define WIDTH self.backView.frame.size.width
#define HEIGHT self.backView.frame.size.height
#import "DKNightVersion.h"
@implementation FindPathSecondAnotherCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)dealloc
{
    [_destinationView release];
    [_littleView release];
    [_destination release];
    [_nameLabel release];
    [_backView release];
    [_images release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}
- (void)create
{
    [DKNightVersionManager addClassToSet:self.class];
    self.nightBackgroundColor = UIColorFromRGB(0x343434);
    
    
    self.backView = [[UIView alloc]init];
    [self.contentView addSubview: self.backView];
    [self.backView release];
//    self.backView.backgroundColor = [UIColor yellowColor];
    
    self.images = [[UIImageView alloc]init];
    [self.backView addSubview:self.images];
    [self.images release];
    
    self.littleView = [[UIView alloc]init];
    [self.images addSubview:self.littleView];
    [self.littleView release];
    self.littleView.alpha = 0.3;
    self.littleView.backgroundColor = [UIColor blackColor];
    self.littleView.center = self.contentView.center;
    self.littleView.layer.cornerRadius = 10;
    self.littleView.layer.masksToBounds = YES;
    //    self.littleView.layer.borderWidth = 1;
    
    self.destinationView = [[UIImageView alloc]init];
    [self.backView addSubview:self.destinationView];
    [_destinationView release];
    self.destinationView.image = [UIImage imageNamed:@"surround.png"];
    
    self.destination = [[UILabel alloc]init];
    [self.backView addSubview: self.destination];
    [self.destination release];
//        self.destination.layer.borderWidth = 1;
    self.destination.font = [UIFont fontWithName:@"Helvetica-Bold" size:11];
    self.destination.textColor = [UIColor whiteColor];
    self.destination.textAlignment = NSTextAlignmentCenter;
    
    self.nameLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.nameLabel];
    [self.nameLabel release];
//        self.nameLabel.layer.borderWidth = 1;
    self.nameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:17];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    self.nameLabel.textColor = [UIColor whiteColor];
    
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.backView.frame = CGRectMake(5, 4, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 8);
    self.images.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.littleView.frame = CGRectMake(WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2);
    self.nameLabel.frame = CGRectMake(WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 4);

    self.destinationView.frame = CGRectMake(WIDTH / 4 + WIDTH / 16, HEIGHT / 2 + HEIGHT / 30, WIDTH / 16, HEIGHT / 8);
    self.destination.frame = CGRectMake(WIDTH / 4 + WIDTH / 8, HEIGHT / 2 + HEIGHT / 30, WIDTH / 4, HEIGHT / 8);
}

@end
